<template>
  <div style="padding: 10px">
    <div style="margin: 10px 0">
      <div style="margin: 10px 0">
        <el-button type="primary" @click="load">未取记录</el-button>
        <el-button type="primary" @click="searched">历史寄件记录</el-button>
      </div>

      <el-table  :data="tableData" stripe border style="width: 100%">
        <el-table-column prop="num" label="柜号" sortable style="width:10%"> </el-table-column>
        <el-table-column prop="expresstel" label="快递员手机号"> </el-table-column>
        <el-table-column prop="fromwhere" label="起始地址"> </el-table-column>
        <el-table-column prop="towhere" label="目的地"> </el-table-column>
        <el-table-column prop="cost" label="邮费"> </el-table-column>
        <el-table-column prop="thetime" label="寄件时间" > </el-table-column>
        <el-table-column prop="states" label="状态"> </el-table-column>

      </el-table>
    </div>

    <div style="margin: 10px 0" >
      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[5, 10, 20]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
      >
      </el-pagination>

    </div>

  </div>

</template>

<script>
import request from "@/utils/request";

export default {
  name: "queryDelivery",
  components:{

  },
  data(){
    return {
      user: {},
      form:{},
      dialogVisible: false,
      dialogVisible1: false,
      search: '',
      currentPage: 1,
      pageSize:10,
      total: 0,
      tableData: [],
      postage: 0
    }
  },
  created(){
    let userStr = sessionStorage.getItem("user") || "{}"
    this.user = JSON.parse(userStr)
    this.load()
  },
  methods: {
    load() {
      request.get("/sendexpress/querynotake/"+this.user.tel, {
        params: {
          pageNum:this.currentPage,
          pageSize: this.pageSize,
          search: this.search
        }

      }).then(res => {
        console.log(res)
        this.tableData=res.data.records
        this.total=res.data.total
      })
    },

    searched() {
      request.get("/sendexpress/querytake/"+this.user.tel, {
        params: {
          pageNum:this.currentPage,
          pageSize: this.pageSize,
          search: this.search
        }

      }).then(res => {
        console.log(res)
        this.tableData=res.data.records
        this.total=res.data.total
      })
    },

    handleSizeChange(pageSize) {   //改变当前每页的个数
      this.pageSize=pageSize
      this.load()
    },
    handleCurrentChange(pageNum) {   //改变当前页数
      this.currentPage=pageNum
      this.load()
    }


  }


}
</script>

<style scoped>

</style>